<?php 
$domain = "https://www.pentalink.com";
$sql = "SELECT count(*) FROM `cart` WHERE `session_id`='".$_SESSION[SESSION_PREFIX]['session_id']."';";
$cart_sum = $db->getOne($sql);
?>
<div class="header_content box">
    <div class="header_content_fl">
        <a href="./index.php">
            <img src="../img/logo.jpg" alt="logo">
        </a>
    </div>

    <div class="header_content_mid">
        <div class="search_content box">
            <div class="search_input box">
                <input id="search_input" class="box" type="text" placeholder="输入商品名称、品牌、型号进行搜索" oninput="OnInput (event)"  value="<?php echo trim($_REQUEST['keyword']); ?>">
                <span onclick="goSearch()" style="display: inline-block;width: 70px;height: 35px;border: 1px solid red;position: absolute;"></span>
                <ul style="display: none;">
                </ul>
            </div>
            <p class="input_tip">推荐词：
                <?php
                    $sql = "SELECT * FROM `category` WHERE is_show = 1 ORDER BY `id` DESC ";
                    $category_list = $db->getAll($sql);
                ?>
                <?php
    			foreach($category_list as $key4 => $cate4):
    			?>
                <span><a style="color: #AAAAAA;" href="./product.php?cate_id=<?php  echo $cate4['cate_id'];?>&cid=<?php  echo $cate4['cate_id'];?>"><?php  echo $cate4['title'];?></a></span>
    		    <?php endforeach; ?>
            </p>
        </div>
        <div class="ksbj_a_cut cut_cont box"  id="top_shopping_cut">
            <a href="./cart.php">购物车(<?php echo $cart_sum; ?>)</a>
            <?php if($cart_sum>0):?>
            <div class="cut_cont_tankuang box">
                <ul class="cut_cont_tankuang_list">
                    <?php
                    $tj_cate = array();//下面的推荐分类关联
                    $cart_list = cart_goods($_SESSION[SESSION_PREFIX]['session_id'], 1);
                    $total = order_fee($cart_list);
                    if(!empty($cart_list)):
                    foreach($cart_list as $key => $cart):
                        $sql = "SELECT * FROM `product` WHERE `product_id`='".$cart['product_id']."';";
                        $productSearchInfo = $db->getRow($sql);
                        //图片
                        //$sql = "SELECT * FROM `product_pic` WHERE `product_id`='".$product['product_id']."' LIMIT 1;";
                        $sql = "SELECT *,if(`sort_order` > '0',1,0) AS `is_order` FROM `product_pic` WHERE `ftype`=1 AND `product_id`='".$productSearchInfo['product_id']."' ORDER BY `is_order` DESC, `sort_order` LIMIT 1;";
                        //echo $sql;
                        $pic = $db->getRow($sql);
                        //规格信息
                        $sql = "SELECT * FROM `product_detail` WHERE `pd_id`='".$cart['pd_id']."';";
                        $gg = $db->getRow($sql);
                        
                        $decimals = $productSearchInfo['bigcate_id']=='1'?4:2;
                        
                        $tj_cate[] = $productSearchInfo['cate_id'];
                        $cate_arr = explode(',', $productSearchInfo['cate_ids']);
                        $cateIdS = $cate_arr[0];
                    ?>
                    <li class="box nav_pid_<?php echo $cart['pd_id'];?>" pid="<?php echo $cart['pd_id'];?>">
                        <a href="/new/proDetail.php?id=<?php echo $productSearchInfo['product_id'];?>&cate_id=<?php echo $cateIdS;?>">
                            <img class="fl" src="<?php echo $domain; ?>/upload<?php echo $pic['pic100'];?>" alt="<?php echo $productSearchInfo['title'];?>">
                            <div class="cut_item_info fl">
                                <h2 class="ellipsis"><?php echo $productSearchInfo['title'];?></h2>
                                <p class="ellipsis">SKU：<span><?php echo $gg['sku'];?></span></p>
                                <p class="ellipsis">规格：<span><?php echo $gg['xy_value'];?></span></p>
                            </div>
                        </a>
                        <div class="cut_item_price fr">
                            <h3>￥<?php echo $cart['price']; ?><span>x <?php echo $cart['pcount']; ?></span></h3>
                            <p onclick="ShopcartDeleteNav(<?php echo $gg['pd_id'];?>);">删除</p>
                        </div>
                    </li>
                    <?php
                    endforeach;
                    endif;
                    ?>
                </ul>
                <div class="cut_cont_tankuang_heji box">
                    <p>合计<span class="nav_price_total">￥<?php echo $total['goods_price'];?></span></p>
                    <a  href="./cart.php" class="go">去购物车结算>></a>
                </div>
            </div>
            <?php endif;?>
        </div>
    </div>

    <div class="header_content_fr">
        <div class="code_img"><img src="../img/code.png" alt="二维码"></div>
        <p class="code_tip">订单/资讯随手掌握</p>
    </div>
</div>